<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="现金日志" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doShow(billType,billId){
		var url="";
		var h=0;
		if(billType=="BUSINESS_BILL"){
			url="/business/BusinessBillEdit.ihtm?id="+billId;
			h=600;
		}else if(billType=="RECEIVE_BILL"){
			url="/finance/ReceiveBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="PURCHASE_BILL"){
			url="/purchase/PurchaseBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="PAY_BILL"){
			url="/finance/PayBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="FEE_BILL"){
			url="/finance/FeeBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="INCOME_BILL"){
			url="/finance/IncomeBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="TRANSFER_BILL"){
			url="/finance/TransferBillEdit.ihtm?id="+billId;
			h=420;
		}else if(billType=="COOPER_BILL"){
			url="/cooper/CooperBillEdit.ihtm?id="+billId;
			h=500;
		}else if(billType=="LOAN_BILL"){
			url="/finance/LoanBillEdit.ihtm?id="+billId;
			h=420;
		}else{
			return;
		}
		ShowIframe("查看",url,1024,h,"",900,600);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
	}
	function doSearch(){
		var startDate=document.getElementById("start_date").value;
		var endDate=document.getElementById("end_date").value;
		var baId=document.getElementById("ba_id").value;
		if(startDate!=null && startDate!=''){
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return;
			}
		}else{
			ShowAlert('提示框','请选择开始日期',200,100);
			return;
		}
		if(endDate!=null && endDate!=''){
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				aShowAlert('提示框','结束日期格式不正确',200,100);
				return;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','结束日期格式不正确',200,100);
				return;
			}
		}else{
			ShowAlert('提示框','请选择结束日期',200,100);
			return;
		}
		if(baId==null || baId=="" || baId=="0"){
			ShowAlert('提示框','请选择账户',200,100);
			return;
		}
		window.location="/finance/AccountLogList.ihtm?ba_id="+baId+"&start_date="+startDate+"&end_date="+endDate;
	}
</script>
</head>
<body onLoad="doInit();" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>现金日志</h2>
      <p>查看现金的操作日志</p>
    </div>
  </div>
	  <div class="sheet-list">
	    <div class="search-business">
	      <div class="content">
              <div align="right">
              	日期：<input type="text" class="TextBox Datetime" maxlength="15" id="start_date" name="start_date" value="${startDate}">
				<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this);">
				至<input type="text" class="TextBox Datetime" maxlength="15" id="end_date" name="end_date" value="${endDate}">
				<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this);">
				
				<select name="ba_id" id="ba_id">
					<option value="0">==请选择帐户==</option>
					<c:forEach var="item" items="${baList}">
						<option value="${item.id}" <c:if test="${baId==item.id}">selected</c:if>>${item.bankName}<c:if test="${item.accountName!=null && item.accountName!=''}">(${item.accountName})</c:if></option>
					</c:forEach>
	  			</select>
				<input type="button"  value=" 查 询" onClick="doSearch();"  class="buttom search-but">   
			   </div>
	      </div>
	      <div class="table-list">
	        <table width="100%">
				<tr>
					<th width="10%">记账日期</th>
					<th width="10%">单据日期</th>
					<th width="14%">单号</th>
					<th width="8%">类型</th>
					<th width="14%">摘要</th>
					<th width="10%">收入</th>
					<th width="10%">支出</th>
					<th width="12%">账户余额</th>
					<th width="12%">账户</th>
				</tr>
				<c:forEach var="item" items="${list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="#000000" />
					<c:if test="${item.operType=='UN_EXAM' || item.operType=='CANC'}"><c:set var="defaultFontColor" value="red" /></c:if>
					<tr class="${trClass}" index="${i.index+1}" style="color:${defaultFontColor}" defaultFontColor="${defaultFontColor}" onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td><fmt:formatDate value="${item.costDate}" pattern="yyyy-MM-dd HH:mm" /></td>
						<td><fmt:formatDate value="${item.billDate}" pattern="yyyy-MM-dd" /></td>
						<td><a href="javascript:doShow('${item.billType}','${item.billId}');">${item.billCode}</a></td>
						<td>${item.costType}</td>
						<td>${item.mark}</td>
						<td>
							<c:if test="${item.rcType=='R'}">${item.cost}</c:if>
							<c:if test="${item.rcType=='P'}">0</c:if>
						</td>
						<td>
							<c:if test="${item.rcType=='R'}">0</c:if>
							<c:if test="${item.rcType=='P'}">${item.cost}</c:if>
						</td>
						<td>${item.baCost}</td>
						<td><commonTag:showSimpleObjectName list="${baList}" objectId="${item.bankAccountId}" /></td>
					</tr>
				</c:forEach>
			</table>
	      </div>     
	    </div>
	  </div>
	<div class="blank12"></div>
</div>
</body>
</html>